package com.fengycx.fallback;

import com.fengycx.constants.GlobalExceptionCode;
import com.fengycx.exception.GlobalException;
import com.fengycx.feign.AppLoginApi;
import com.fengycx.pojo.param.AppLoginApiParam;
import com.fengycx.result.R;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class AppLoginApiFallbackFactory implements FallbackFactory<AppLoginApi> {

    @Override
    public AppLoginApi create(Throwable cause) {
        cause.printStackTrace();
        return new AppLoginApi() {
            @Override
            public R<Boolean> appLogin(AppLoginApiParam login) {
                return R.error(GlobalExceptionCode.SERVICE_ERROR);
            }
        };

    }
}
